Method for optimized representation of page table entries

ABSTRACT

Method for producing a predetermined length page memory pointer record, according to a selected page size and a selected page address, the method including the procedures of: determining a dynamic location of a separator bit within the page memory pointer record, according to the selected page size and an initial page size, the initial page size being respective of the smallest page size in a given memory system, writing a predetermined value to the dynamic location, writing a sequence of values opposite to the predetermined value to selected page size bits of the page memory pointer record, when the selected page size is different than the initial page size, and writing the selected page address to selected page address bits of the page memory pointer record.

FIELD OF THE INVENTION

[0001] The present invention relates to methods and system for memory management in general, and to methods and systems for managing memory in pages, in particular.

BACKGROUND OF THE INVENTION

[0002] Intermediate storage elements are known in the art. A conventional computer system includes random access memory (RAM), which is used for uploading software objects, executing them and for storing data objects, used by the software objects.

[0003] The RAM size is often limited. When the memory requirements exceed the RAM size, then the system can allocate a storage area on another storage element, such as a hard drive, and define this storage area as virtual memory, serving as an extension of the RAM. Data portions, which are not often used, can be stored in the virtual memory until the system retrieves them for further processing.

[0004] The RAM of a conventional computer system can be in the range of 32MB-2GB and the numbers increase constantly. It will be appreciated by those skilled in the art that the small data segments (a single bit, a byte and a word) can not be used for allocating memory in an efficient way. Conventional methods for managing memory allocate large portions of these segments. These portions are in the range of several kilobytes to several megabytes.

[0005] One conventional method, known in the art, for managing memory resources is called paged memory. This method determines a plurality of memory portions, called memory pages. Each memory page is of a predetermined set of sizes (for example, 4KB, 16KB). The memory is managed by a memory management module within the computer system, which can be implemented either in hardware or in software, either as a part of the operating system or of the computer chip-set.

[0006] The memory management module receives a memory allocation request for a block of memory, from a software module. The memory management module allocates memory pages having a total size, which can contain the requested amount of memory.

[0007] For each allocated memory portion, the memory allocator provides both a physical location and a logical representation. The physical location includes a selected portion of the overall memory size available in the computer system. The logical representation is the address seen by the software module. This address is used to index an entry in a specialtable, called page table, which points to the physical location. It is noted that additional management mechanisms can be added to this structure, but those mechanisms will not be discussed herein below, so as to maintain the simplicity of the description.

[0008] The entries in the page table are called page table entries. Page table entries should indicate the physical address of the page, the page size and additional attributes about the page. The page size is always a power of 2, and the page address is always aligned on a page boundary (that is, can be divided by the page size). A page record is adapted to the environment in which it is processed. In a sixty-four-bit processor, this record includes sixty-four bits and so does the entire address space. In an example, where the size of a memory page block is 4KB (2¹²), fifty-two bits are required to point to any such block. In a system, which utilizes memory pages in several sizes, the page record has to include additional information relating to the size of the page associated with that record. The remaining bits in the record are used for various attributes such as, “read only”, “modified”, “write once”, “for system use only” and the like.

[0009] Reference is now made to FIGS. 1A and 1B. FIG. 1A is a representation of a page table entry string, generally referenced 10, representing a predetermined page, which is known in the art. FIG. 1B is a representation of the memory page record string of FIG. 1A, representing a different memory page.

[0010] With reference to FIG. 1A, string 10 is divided into sub strings 12, 14 and 16. Sub-string 12 is a representation of the page address, sub-string 14 is a representation of the page size and sub-string 16 is a representation of the memory page attributes.

[0011] In the present example, the overall length of string 10 is sixty four bits, the length of page address sub-string 12 is fifty two bits, and the page size representation sub-string 14 includes three bits, which provide up to eight options of page sizes (2³). In the present example, the system utilizes the following page sizes: 4KB, 8KB, 16KB, 32KB, 64KB, 128KB, 256KB and 512KB. As a result of the above, the length which is set for the attribute sub-string is nine bits. It is noted that the system can utilize page sizes, which are not sequential, such as 4KB, 32KB, 64KB, 256KB, and the like.

[0012] Page size representation sub-string 14 stores a sequence “000” which, in the present example, indicates the first and smallest page size of 4KB. With reference to FIG. 1B, the page size representation sub-string 14 stores a sequence “010” which, in the present example, indicates the third page size of 16KB.

[0013] According to the above arrangement, the length of the attribute representation sub-string is the result of subtraction of the address sub-string and the size sub-string from the overall length of the page record string.

[0014] The above arrangement is also limited to eight different sizes of pages. If the system utilizes a greater number of pages, then additional bits have to be allocated from the attribute sub-string to the page size sub-string, thus reducing even more the length of the attribute sub-string.

SUMMARY OF THE PRESENT INVENTION BRIEF DESCRIPTION OF THE DRAWINGS

[0015] The disclosed technique will be understood and appreciated more fully from the following detailed description taken in conjunction with the drawings in which:

[0016]FIG. 1A is a representation of a memory page record string, representing a predetermined page size, which is known in the art;

[0017]FIG. 1B is a representation of the memory page record string of FIG. 1A, representing a different memory page size;

[0018]FIG. 2A is an illustration of one embodiment of a memory page record string, representing a first page size;

[0019]FIG. 2B is an illustration of the memory page record string of FIG. 2A, representing a second page size;

[0020]FIG. 2C is an illustration of the memory page record string of FIGS. 2A and 2B, representing a third page size;

[0021]FIG. 2D is an illustration of the memory page record string of FIGS. 2A, 2B and 2C, representing a general page size;

[0022]FIG. 3 is a schematic illustration of a method for operating a page memory management module, operative in accordance with a further embodiment;

[0023]FIG. 4A is a schematic illustration of a retrieval method for operating a page memory management module, operative in accordance with another embodiment;

[0024]FIG. 4B is a detailed illustration of the procedure of detecting of the retrieval method of FIG. 4A, operative in accordance with a further embodiment; and

[0025]FIG. 5, is a schematic illustration of a computer system, operative in accordance with another embodiment.

DETAILED DESCRIPTION

[0026] The present disclosure provides a novel page address and size representation, which dynamically addresses different size pages. According to one embodiment, a fixed length field contains both the address and size field of pages. The assigned length of this field is one bit longer than the length of the largest page address in the system. Applicant found that the address space in a selected page size is counter-proportional to the page size. For example, if the address space of a 2^(n) page size is 2^(m), then the address space of a 2^(n+k) is 2^(m−k). Hence, the total length of the page size and page address space remains constant, where the n and m are given.

(n+k)+(m−k)=n+m=const

[0027] Accordingly, the disclosed technique assigns a dynamic page address space according to a given page size. The page size is set in a string of sequential bits and is determined according to the smallest page size. For example, a page size sub-string having a length of zero (no bits) denotes the smallest page size in the system and a page size sub-string having a length of six bits denotes the seventh page size in the system. In an example, where the smallest page size is 8KB (2¹³), then the seventh page size in the system is 512KB (2¹⁹). One embodiment includes a separator sub-string, which in the following examples includes a single bit, of an opposite value than the ones denoting the page size.

[0028] Reference is now made to FIGS. 2A, 2B, 2C and 2D. FIG. 2A is an illustration of a memory page record string, generally referenced 100, representing a first page size, in accordance with one embodiment. FIG. 2B is an illustration of the memory page record string 100 of FIG. 2A, representing a second page size. FIG. 2C is an illustration of the memory page record string 100 of FIGS. 2A and 2B, representing a third page size. FIG. 2D is an illustration of the memory page record string 100 of FIGS. 2A, 2B and 2C, representing a general page size.

[0029] With reference to FIG. 2A, string 100 includes a combined page size and address sub-string 102 and an attribute sub-string 110. Combined sub-string 102 is dynamically divided by a separator bit 106 into a page address sub-string 104 and a page size sub-string 108. The length of the combined sub-string 102 is constant.

[0030] In the example set forth in FIG. 2A, the separator bit, having a value of “0”, is located at the third location from the right side of sub-string 102, thus representing a third level page size and address. Where the smallest page size is 2^(n), the page size provided by this example is 2^(n+2).

[0031] This is denoted by a continuous set of bits, to the right side of the separator bit, until the end of sub-string 102. Each bit in this set of bits, has a value, which is opposite to that of the separator bit 106, as presented by the sequence “11” in the page size sub-string. Hence, combined sub-string 102 represents a third level page size and address. Accordingly, the page address sub-string 104 includes 2^(n−2) bits, suitable for the address space respective of this page size. In case where the minimal page size is 4KB (fifty-two bit address length), then the length of page address sub-string 104 is fifty bits and the overall length of sub-string 102 is fifty three bits.

[0032] With reference to FIG. 2B, the separator bit 106 is located at the first place from the right of sub-string 102, thus representing a first level page size, leaving the entire length of sub-string 102 minus one bit to be the length of the page address sub-string 104. According to this example, the length of the page size sub-string 108 is zero (no bits). In case where the minimal page size is 4KB (fifty two bit address length), then the length of page address sub-string 104 is fifty two bits and the overall length of sub-string 102 remains fifty three bits.

[0033] With reference to FIG. 2C, the separator bit 106 is located at the seventh place from the right of sub-string 102, thus representing a seventh level page size. In this case, the page size sub-string includes a sequence of “111111” bits. Accordingly, the page address sub-string 104 includes 2^(n−6) bits, suitable for the address space respective of this page size. In case where the minimal page size is 4KB (fifty two bit address length), then the length of page address sub-string 104 is forty six bits and the overall length of sub-string 102 still remains fifty three bits.

[0034] With reference to FIG. 2D, the separator bit 106 is located at the k^(th) place from the right of sub-string 102, thus representing a k^(th) level page size. Accordingly, the page address sub-string 104 includes 2^(n−k) bits, suitable for the address space respective of this page size (2^(k)). In case where the minimal page size is 4KB (fifty-two bit address length), then the length of page address sub-string 104 is 52−k+1 bits. Again, the overall length of sub-string 102 remains fifty-three bits.

[0035] According to the above example, in a case where the minimal page size is 4KB, the overall length which is required for the page size and address is fifty three bits, which leaves eleven bits for the attribute sub-string 110.

[0036] The disclosed techniques provides a complete variety of page sizes from a predetermined minimal length, up to a page which virtually includes the entire memory, where k=n. The disclosed technique provides this without increasing the sub-string length.

[0037] Reference is now made to FIG. 3, which is a schematic illustration of a further embodiment of a method for operating a page memory management module. In procedures 150 and 152, the characteristics of the entire memory system are defined, according to the available memory size and other parameters, such as statistical data and the like. These procedures are preliminary to this method and can be performed once every restart, or may be determined as a part of system design. The size of the smallest page can for example, be defined according to the length of the attribute sub-string required, where j denotes the attribute sub-string length and 2^(j−1) denotes the size of the smallest memory page. It is noted that from an architecture view point, all page sizes can coexist at the same time for different uses. However, the minimal page size is predetermined for a given architecture.

[0038] In procedure 154, the length of the page address and size sub-string is determined. With respect to FIG. 2A, the length of sub-string 102 is determined. For example, in a sixty-four bit processor where j denotes the attribute sub-string length, the length of sub-string 102 is 64−j and the address space for the smallest page size is 64−j−1.

[0039] In procedure 156, a representation command for a selected page size and page address, is received. This command is received from the memory management module, in response to a system request.

[0040] In procedure 158, the location of the dynamic separator bit is determined according to the level of page size. In general, this place is set directly according to the level of the page size, with respect to the smallest page size level (e.g., the number of the level), from a predetermined page size side of sub-string 102. For example, if the predetermined page size side is left and the page size level in the request is the fifth level, then the location of the separator bit is the fifth bit from the left, within sub-string 102. With reference to FIG. 2A, the predetermined page size side is set to be the right side and thus the location of the separator bit should be the fifth bit from the right side of sub-string 102. It is noted that the determining of the page size side, automatically determines the page address side to the opposite thereof. In the example set fourth in FIG. 2A, where the page size side is determined the right side, then the page address side is thus determined left.

[0041] In procedure 160, a predetermined value is written to the recently determined separator bit location and a plurality of opposite values are written to all of the bits which are located on the predetermined page size side of the separator bit (procedure 162). With reference to FIG. 2A, where the separator bit 106 is set to be “0”, then page size sub-string 108 is set to be a sequence of “1” value bits. It is noted that this procedure is virtually skipped at the first page size level, where the length of the page size sub-string is null (no bits) as in FIG. 2B. Alternatively, the separator bit can have a value of “1” and the page size sub-string bits can accordingly have values of “0”.

[0042] In procedure 164, the page address is written to the page address sub-string, which is located at the opposite side of the separator bit. With reference to FIG. 2A, the page address is written to the page address sub-string 104.

[0043] Reference is now made to FIG. 4A, which is a schematic illustration of a retrieval method for operating a page memory management module, in accordance with another embodiment.

[0044] In procedure 170, a memory page record is received. This record is retrieved from a page memory table. In procedure 172, the page size sub-string end is accessed and a search procedure for the separator bit is initiated (procedure 174). With reference to FIG. 2A, the memory management module accesses the bit which is located at the right end of sub-string 102 and starts scanning to the left.

[0045] Reference is further made to FIG. 4B, which is a detailed illustration of the procedure of detecting of the retrieval method of FIG. 4A, operative in accordance with a further embodiment. In procedure 180, the current bit is compared against a predetermined value, assigned for the separator bit. With reference to FIG. 2A, the memory management module detects if the currently accessed bit (e.g., the first bit on the right side of sub-string 102) has a value of “0”. If so, then the memory management module proceeds to procedure 184 and determines that location as the location of the separator bit. Otherwise, the memory management module proceeds to procedure 182.

[0046] In procedure 182, the memory management module proceeds to the adjacent bit in sub-string 102, in the direction of the page address (e.g., to the left) and repeats from procedure 180.

[0047] Referring back to FIG. 4A, in procedure 176, the page size is determined according to the location of the separator bit. Alternatively, the page size can be determined according to the number of bits in sub-string 108, all having a value opposite to the predetermined value of the separation bit, as described above. According to the determined page size, the page address (length and position of the page address sub-string) can be determined (procedure 178) and the address can be retrieved therefrom.

[0048] It is noted that further procedures of retrieving the actual page from the memory can be added, and are not described herein.

[0049] Reference is now made to FIG. 5, which is a schematic illustration of a computer system, generally referenced 200, operative in accordance with another embodiment. Computer system 200 includes a communication interface 202, a user interface 204, a CPU 206, a storage unit 208, and a memory unit 210. Memory unit 210 includes a page memory table 212 therein.

[0050] Communication interface 202, user interface 204, CPU 206, storage unit 208, and memory unit 210 are interconnected via bus 214.

[0051] Communication interface 202 provides communication between computer system 200 and a remote computer, or a plurality of computers connected in a network (not shown). Communication interface 202 may consist of a wired or a wireless module known in the art, such as a modem and the like. User interface 204 provides communication between computer system 200 and a user. User interface 204 may consist of a visual, tactile, or audio unit known in the art, such as monitor, keyboard, pointing device, microphone, speaker and the like.

[0052] Storage unit 208 may consist of a module for storage and retrieval of data, as known in the art, such as a hard drive, an optical drive and the like. Memory unit 210 may consist of a board mounted chip of the type known in the art, such as RAM, DRAM, SDRAM, and the like. Page memory table 212 contains memory page records as described herein above, in conjunction with FIGS. 4A-4D.

[0053] CPU 206 defines a plurality of memory pages, which are either located in memory unit 210 or in storage unit 208. CPU 206 utilizes page memory table 212 in the process of managing these memory pages.

[0054] It will be appreciated by persons skilled in the art that the disclosed technique is not limited to what has been particularly shown and described herein above. Rather the scope of the disclosed technique is defined only by the claims, which follow. 

What is claimed is:
 1. Method for producing a predetermined length page memory pointer record, according to a selected page size and a selected page address, the method comprising the procedures of: determining a dynamic location of a separator bit within said page memory pointer record, according to said selected page size and an initial page size, said initial page size being respective of the smallest page size in a given memory system; writing a predetermined value to said dynamic location; writing a sequence of values opposite to said predetermined value to selected page size bits of said page memory pointer record, when said selected page size is different than said initial page size; and writing said selected page address to selected page address bits of said page memory pointer record.
 2. The method according to claim 1, further comprising the procedures of: determining the location of said selected page size bits, at one side of said separator bit; and determining the location of said selected page address bits, at the other side of said separator bit.
 3. The method according to claim 1, further comprising the procedures of: determining the location of said selected page address bits, at one side of said separator bit; and determining the location of said selected page size bits, at the other side of said separator bit.
 4. The method according to claim 1, further comprising the procedure of determining the length of said sequence of values to be one less than the level of said selected page size.
 5. The method according to claim 1, further comprising the procedure of determining attribute bits in said predetermined length page memory pointer record, said attribute bits being other than said page address bits, said page size bits and said separator bit.
 6. Memory page pointer record comprising; a dynamic length page address sub-string; a dynamic length page size sub-string; and a separator bit located between said page address sub-string and said page size sub-string.
 7. The memory page pointer record according to claim 6, further comprising attribute bits.
 8. The memory page pointer record according to claim 6, wherein the sum of said dynamic length of said page address sub-string and said dynamic length of said page size sub-string, is constant.
 9. The memory page pointer record according to claim 6, wherein the value of said separator bit is predetermined.
 10. The memory page pointer record according to claim 9, wherein the value of each of the bits of said page size sub-string is opposite to said value of said separator bit.
 11. In a multi page size memory system, including an initial page size, said initial page size being respective of the smallest page size in the memory system, a method for retrieving page size and page address from a memory page pointer record, the memory page pointer record having a dynamic length page size sub-string and a dynamic length page address sub-string, separated by a separator bit, the method comprising the procedures of: detecting the location of said separator bit; determining the page size from the location of said separator bit; determining the location and length of said dynamic length page address sub-string, from said location of said separator bit; and retrieving the page address from said dynamic length page address sub-string.
 12. The method according to claim 11, wherein said step of detecting the location of said separator bit is performed according to the content of said page size sub-string.
 13. Computer system comprising: a memory unit, containing at least one page address table; and a processor, coupled with said memory unit, said processor managing a plurality of memory pages of different sizes, utilizing said at least one page address table, said at least one page address table including a plurality of page records, each said page record including a separator bit, located at a variable location within said page record, said variable location indicating the size of a selected one of said memory pages, associated with said page record.
 13. The computer system according to claim 13, wherein said memory unit further contains at least one of said memory pages.
 14. The computer system according to claim 13, further comprising a storage unit, coupled with said processor, said storage unit containing at least one of said memory pages.
 15. The computer system according to claim 13, wherein each said page record includes a page address sub-string, located adjacent to said separator bit on a predetermined side of said separator bit, said page address sub-string containing a representation of the address of a memory page associated with said page record.
 16. The computer system according to claim 15, wherein said page address sub-string is characterized by a dynamic length, said dynamic length being dependent on the location of said separator bit.
 17. The computer system according to claim 13, wherein each said page record includes a page size sub-string, located adjacent to said separator bit, including zero or more identical value bits, said value being opposite to the value of said separator bit.
 19. The computer system according to claim 13, wherein each said page record further includes attribute bits in said predetermined length page memory pointer record, said attribute bits being other than said page address bits, said page size bits and said separator bit. 